package com.lianzheng.dao.impl;

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.lianzheng.dao.TbDocVideoaudiotypeDAO;
import com.lianzheng.model.TbDocVideoaudiotype;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.stereotype.Repository;


/**
 * This class interacts with Spring's IbatisTemplate to save/delete
 * <p>
 * <a href="TbDocVideoaudiotype.DAOimpl.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author <a href="mailto:heymanchen@gmail.com">haihua chen</a>
*/
@Repository
public class TbDocVideoaudiotypeDAOimpl extends SqlMapClientDaoSupport implements TbDocVideoaudiotypeDAO {

    /**
     * @see com.lianzheng.dao.TbDocVideoaudiotypeDAO#getTbDocVideoaudiotype($keytype)
     */

    public TbDocVideoaudiotype getTbDocVideoaudiotype(String typeid){
        return (TbDocVideoaudiotype)getSqlMapClientTemplate().queryForObject("getTbDocVideoaudiotype", typeid);
    }

    public TbDocVideoaudiotype getTbDocVideoaudiotypeFull(String typeid){
        return (TbDocVideoaudiotype)getSqlMapClientTemplate().queryForObject("getTbDocVideoaudiotypeFull", typeid);
    }

    public void addTbDocVideoaudiotype(final TbDocVideoaudiotype tbDocVideoaudiotype) {
        getSqlMapClientTemplate().update("addTbDocVideoaudiotype", tbDocVideoaudiotype);
    }

    public void updateTbDocVideoaudiotype(final TbDocVideoaudiotype tbDocVideoaudiotype) {
    getSqlMapClientTemplate().update("updateTbDocVideoaudiotype", tbDocVideoaudiotype);
    }

    public void removeTbDocVideoaudiotype(String typeid){
        getSqlMapClientTemplate().update("removeTbDocVideoaudiotype", typeid);
    }

    public List getTbDocVideoaudiotypes() {
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudiotypes",null);
    }

    public List getTbDocVideoaudiotypeByAnd(final TbDocVideoaudiotype tbDocVideoaudiotype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_AND, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudiotype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudiotypeByMap", tbDocVideoaudiotype);
    }

    public List getTbDocVideoaudiotypeByOr(final TbDocVideoaudiotype tbDocVideoaudiotype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_OR, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudiotype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudiotypeByMap", tbDocVideoaudiotype);
    }
    
    public List getTbDocVideoaudiotypeByLike(final TbDocVideoaudiotype tbDocVideoaudiotype,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_LIKE, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudiotype.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudiotypeByMap", tbDocVideoaudiotype);
    }
}